import { defineStore } from 'pinia'
import { ref } from 'vue'
// import { userGetInfoService } from '../../api/user'

// 用户模块 token setToken removeToken
export const useQuestionStore = defineStore(
  'question',
  () => {
    const QuestionInfo = ref()
    const setQuestionInfo = (Question) => {
      QuestionInfo.value = Question
    }
    const removeQuestionInfo = () => {
      QuestionInfo.value = null
    }

    // 获取用户信息
    // const Question = ref({})
    // const getQuestion = async () => {
    //   const res = await QuestionGetInfoService() // 请求获取数据
    //   Question.value = res.data.data
    // }
    // const setQuestion = (obj) => {
    //   Question.value = obj
    // }

    return {
      QuestionInfo,
      setQuestionInfo,
      removeQuestionInfo
    }
  },
  {
    persist: {
      enabled: true,
      storage: localStorage
    }
  }
)
